#include <bits/stdc++.h>
using namespace std;

const int N = 2e5 + 1;
using ll = long long;
ll n, ret, sz;
ll arr[N], f[100];

int main()
{
	cin >> n;
	for (int i = 0; i < n; i++) cin >> arr[i];
	while (arr[0] > 1)
	{
		ret++;
		f[sz++] = arr[0];
		arr[0] = floor(sqrt(floor(arr[0] / 2.0) + 1));
	}
	for (int i = 1; i < n; i++)
	{
		ll t = arr[i];
		while (t > 1)
		{
			int flag = 0;
			for (int i = 0; i < sz; i++)
			{
				if (f[i] == t) 
				{
					flag = 1;
					break;
				}
			}
			if (flag == 1) break;
			ret++;
			t = floor(sqrt(floor(t / 2.0) + 1));
		}
		sz = 0;
		while (arr[i] > 1)
		{
			f[sz++] = arr[i];
			arr[i] = floor(sqrt(floor(arr[i] / 2.0) + 1));
		}
	}
	cout << ret << endl;
	return 0;
}
